<?php
// +----------------------------------------------------------------------
// | sfadmin - Suifeng Administration
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://suifeng.tech All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: suifeng <1787585212@qq.com>
// +----------------------------------------------------------------------

namespace suifeng\builder\table\column;

use suifeng\helper\HtmlHelper;

class Image extends Text
{
    /**
     * 输出单元格内容。
     *
     * @param unknown $row
     * @return unknown|string
     */
    protected function _fetch_cell_content($row)
    {
        $value = $this->_get_cell_value($row);
        if (empty($value)) {
            return '&nbsp;';
        }

        $html = '';

        $list = explode(',', $value);
        foreach ($list as $image_id) {
            $html .= HtmlHelper::render_tag('image', array(
                'class' => 'picture',
                'src' => get_cover($value),
            ));
        }

        return $html;

    }
}
